﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AddCodeMapping.ascx.cs"
    Inherits="WebForm_ManageCodeMapping_AddCodeMapping" %>
<My:MyFormView ID="fvParameter" runat="server" DefaultMode="Insert" OnItemUpdating="fvParameter_ItemUpdating"
    DataKeyNames="TableName,ColumnName,Value" OnItemCommand="fvParameter_ItemCommand"
    DataSourceID="AddObjDataSource" OnDataBound="fvParameter_DataBound">
    <ItemTemplate>
    </ItemTemplate>
    <EditItemTemplate>
        <table>
            <tr>
                <td align="right" style="height: 26px">
                    <asp:Label ID="Edit_lblTableText1" runat="server" meta:resourcekey="Edit_lblTableText1"></asp:Label>
                </td>
                <td align="left" style="height: 26px">
                    <asp:Label ID="Edit_lblTableText2" runat="server" Text='<%# Eval("TableText") %>'></asp:Label></td>
                <td>
                    <asp:Label ID="Edit_lblTableName" runat="server" Text='<%# Eval("TableName") %>'
                        Visible="False"></asp:Label></td>
            </tr>
            <tr>
                <td align="right" style="height: 26px">
                    <asp:Label ID="Edit_lblColumnText1" runat="server" meta:resourcekey="Edit_lblColumnText1"></asp:Label>&nbsp;</td>
                <td align="left" style="height: 26px">
                    <asp:Label ID="Edit_lblColumnText2" runat="server" Text='<%# Eval("ColumnText") %>'></asp:Label></td>
                <td style="height: 23px">
                    <asp:Label ID="Edit_lblColumnName" runat="server" Text='<%# Eval("ColumnName") %>'
                        Visible="False"></asp:Label></td>
            </tr>
            <tr>
                <td align="right" style="height: 26px">
                    <asp:Label ID="Edit_lblValue1" runat="server" meta:resourcekey="Edit_lblValue1"></asp:Label>
                </td>
                <td align="left" style="height: 26px">
                    <asp:Label ID="Edit_lblValue2" runat="server" Text='<%# Eval("Value") %>'></asp:Label></td>
                <td style="height: 33px">
                    <asp:Label ID="Edit_lblValue" runat="server" Text='<%# Eval("Value") %>' Visible="False"></asp:Label></td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="Edit_lblText1" runat="server" meta:resourcekey="Edit_lblText1"></asp:Label>&nbsp;</td>
                <td align="left">
                    <asp:TextBox ID="Edit_txtText" MaxLength="50" runat="server" Text='<%# Bind("Text") %>' ValidationGroup="vSave"></asp:TextBox></td>
                <td>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="Edit_lblMOIValue" runat="server" meta:resourcekey="Edit_lblMOIValue1"></asp:Label>&nbsp;</td>
                <td align="left">
                    <asp:TextBox ID="Edit_txtMOIValue" MaxLength="50" runat="server" Text='<%# Bind("MOIValue") %>'></asp:TextBox></td>
                <td>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="lblActive" runat="server" meta:resourcekey="lblActive"></asp:Label></td>
                <td align="left">
                    <asp:DropDownList ID="ddlActive" runat="server" DataSourceID="CodeMappingSqlDataSource_ddlActive"
                        DataTextField="Text" DataValueField="Value" OnDataBound="ddlActive_DataBound" SelectedValue='<%#Bind("Active") %>' >
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="rfvActive" runat="server" ControlToValidate="ddlActive"
                        Display="None" ValidationGroup="vInsert" meta:resourcekey="rfvActive" ></asp:RequiredFieldValidator></td>
                    
                    <My:CodeMappingSqlDataSource ID="CodeMappingSqlDataSource_ddlActive" runat="server" TableName="CodeMapping" ColumnName="Active">
                    </My:CodeMappingSqlDataSource>
<%--                    <asp:SqlDataSource ID="SqlDataSource_ddlActive" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
                        SelectCommand="SELECT [Value], [Text] 
FROM [CodeMapping] 
WHERE (([TableName] = @TableName) AND ([ColumnName] = @ColumnName)) ">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="CodeMapping" Name="TableName" Type="String" />
                            <asp:Parameter DefaultValue="Active" Name="ColumnName" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>   --%>                 
                    
                </td>
            </tr>                        
            <tr>
                <td align="right" style="height: 21px">
                    &nbsp;</td>
                <td align="left" style="height: 21px">
                    <asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" ValidationGroup="vSave"
                        OnClick="btnSave_Click" /></td>
                <td>
                </td>
            </tr>
        </table>
    </EditItemTemplate>
    <InsertItemTemplate>
        <table>
            <tr>
                <td align="right" style="height: 26px">
                    <asp:Label ID="Insert_lblTableText1" runat="server" meta:resourcekey="Insert_lblTableText1"></asp:Label>
                </td>
                <td align="left" style="height: 26px">
                    <My:MyDropDownList ID="ddlTableText" runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource1"
                        OnDataBound="ddlTableText_DataBound" DataTextField="TableText" DataValueField="CodeHeaderID"
                        OnSelectedIndexChanged="ddlTableText_SelectedIndexChanged">
                    </My:MyDropDownList>
                </td>
                <td style="width: 3px">
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetdllTableTextItem"
                        TypeName="CodeMappingDAO"></asp:ObjectDataSource>
                    &nbsp;</td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="Insert_lblColumnText1" runat="server" meta:resourcekey="Insert_lblColumnText1"></asp:Label></td>
                <td align="left">
                    <My:MyDropDownList ID="ddlColumnName" runat="server" DataTextField="ColumnText" DataValueField="ID"
                        OnDataBound="ddlColumnName_DataBound" OnSelectedIndexChanged="ddlColumnName_SelectedIndexChanged">
                    </My:MyDropDownList>
                </td>
                <td style="width: 3px">
                </td>
            </tr>
            <tr>
                <td align="right" style="height: 45px">
                    <asp:Label ID="Insert_lblValue1" runat="server" meta:resourcekey="Insert_lblValue1"></asp:Label>
                </td>
                <td align="left" style="height: 45px">
                    <asp:TextBox ID="txtValue" MaxLength="50" runat="server" ValidationGroup="vInsert"></asp:TextBox></td>
                <td style="width: 3px; height: 45px;">
                    <asp:RequiredFieldValidator ID="rfvValue" runat="server" ControlToValidate="txtValue"
                        Display="None" ValidationGroup="vInsert" meta:resourcekey="rfvValue"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="Insert_lblText1" runat="server" meta:resourcekey="Insert_lblText1"></asp:Label></td>
                <td align="left">
                    <asp:TextBox ID="txtText" MaxLength="50" runat="server" ValidationGroup="vInsert"></asp:TextBox></td>
                <td style="width: 3px">
                    <asp:RequiredFieldValidator ID="rfvText" runat="server" ControlToValidate="txtText"
                        Display="None" ValidationGroup="vInsert" meta:resourcekey="rfvText"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="Insert_lblMOIValue1" runat="server" meta:resourcekey="Insert_lblMOIValue1"></asp:Label></td>
                <td align="left">
                    <asp:TextBox ID="txtMOIValue" MaxLength="50" runat="server"></asp:TextBox></td>
                <td style="width: 3px">
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="lblActive" runat="server" meta:resourcekey="lblActive"></asp:Label></td>
                <td align="left">
                    <asp:DropDownList ID="ddlActive" runat="server" DataSourceID="SqlDataSource_ddlActive"
                        DataTextField="Text" DataValueField="Value" OnDataBound="ddlActive_DataBound">
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="rfvActive" runat="server" ControlToValidate="ddlActive"
                        Display="None" ValidationGroup="vInsert" meta:resourcekey="rfvActive"></asp:RequiredFieldValidator></td>
                <asp:SqlDataSource ID="SqlDataSource_ddlActive" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
                    SelectCommand="SELECT [Value], [Text] 
FROM [CodeMapping] 
WHERE (([TableName] = @TableName) AND ([ColumnName] = @ColumnName))
order by Sequence ">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="CodeMapping" Name="TableName" Type="String" />
                        <asp:Parameter DefaultValue="Active" Name="ColumnName" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td align="right" style="height: 21px">
                </td>
                <td align="left" style="height: 21px">
                    <asp:Button ID="btnInsert" runat="server" meta:resourcekey="btnInsert" ValidationGroup="vInsert"
                        OnClick="btnInsert_Click" /></td>
                <td style="width: 3px">
                </td>
            </tr>
        </table>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
            ShowSummary="False" ValidationGroup="vInsert" />
    </InsertItemTemplate>
</My:MyFormView>
&nbsp; &nbsp;
<%--<asp:ObjectDataSource ID="AddObjDataSource" runat="server" InsertMethod="InsertData" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetData" TypeName="CodeMappingDAO" UpdateMethod="UpdateData" OnUpdating="AddObjDataSource_Updating" >--%>
<asp:ObjectDataSource ID="AddObjDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetData" TypeName="CodeMappingDAO" OnUpdating="AddObjDataSource_Updating">
    <UpdateParameters>
        <%--        <asp:SessionParameter Name="TableName" SessionField="TableName" Type="String" />
        <asp:SessionParameter Name="ColumnName" SessionField="ColumnName" Type="String" />
        <asp:SessionParameter Name="Value" SessionField="Value" Type="String" />--%>
        <asp:Parameter Name="original_TableName" Type="String" />
        <asp:Parameter Name="original_ColumnName" Type="String" />
        <asp:Parameter Name="original_Value" Type="String" />
        <asp:Parameter Name="Text" Type="String" />
        <asp:Parameter Name="MOIValue" Type="String" />
    </UpdateParameters>
    <SelectParameters>
        <asp:Parameter Name="TableName" Type="String" />
        <asp:Parameter Name="ColumnName" Type="String" />
        <asp:Parameter Name="Value" Type="String" />
        <asp:Parameter Name="Text" Type="String" />
        <asp:Parameter Name="Active" Type="String" />
    </SelectParameters>
    <InsertParameters>
        <asp:Parameter Name="TableName" Type="String" />
        <asp:Parameter Name="ColumnName" Type="String" />
        <asp:Parameter Name="Value" Type="String" />
        <asp:Parameter Name="Text" Type="String" />
        <asp:Parameter Name="MOIValue" Type="String" />
        <asp:Parameter Name="Active" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetdllTableTextItem"
    TypeName="CodeMappingDAO">
    <SelectParameters>
        <%--<asp:SessionParameter Name="CodeHeaderID" SessionField="ddlCodeHeaderID" Type="String" />--%>
        <asp:Parameter Name="CodeHeaderID" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
